@extends('blog.layouts.default')

@section('content')

  <header class="tags-bg">
    @include('blog.layouts.navbar')
    <div class="heading">
      <h1>Tags</h1>
      <span>不勤于始，将悔于终</span>
    </div>
  </header>

  <div class="tags-content container">
    <div class="tags-list hr">
      @if ($tags->count() > 0)
        @foreach ($tags as $tag)
          <a href="{{ route('tags', $tag->name) }}" class="{{ $tag->name === $active_tag ? 'active' : '' }}">{{ $tag->name }}</a>
        @endforeach
      @endif
    </div>

    @if ($posts->count() > 0)
      <div class="preview-list">
        @foreach ($posts as $post)
        <div class="preview hr">
          <a href="{{ route('detail', $post->slug) }}">
            <span class="preview-title">{{ $post->title }}</span>
            <div class="preview-body">{!! $post->summary !!}</div>
          </a>
          <span class="preview-date">Published on {{ $post->publish_date }}</span>
        </div>
        @endforeach

        {!! $posts->links('vendor.pagination.simple') !!}
      </div>
    @endif

  </div>

@endsection
